<script setup>
import { reactive, toRefs } from "vue";
import MyDatails from "../../components/MyDatails.vue";
import { useRoute } from "vue-router";
import { gepasswordAPi } from "../../http/http";
const route = useRoute();

const data = reactive({
  form: {
    user_pass: "",
    mobile: route.query.mobile,
    sms_code: route.query.sms_code,
    sureUser_pass: "",
  },
});

// 点击提设置密码
const onSubmit = async () => {
  let res = await gepasswordAPi();
  console.log(res);
  if (res.code == 200) {
    Toast(`${res.msg}`);
  }
};
const { form } = toRefs(data);
</script>
<template>
  <div class="setpassword">
    <!-- 头部 -->
    <MyDatails>
      <template #left>
        <van-icon name="arrow-left" @click="$router.back" />
      </template>
      <template #text>
        <span>设置密码</span>
      </template>
    </MyDatails>
    <!-- 输入框 -->
    <van-cell-group inset>
      <van-field v-model="form.user_pass" placeholder="请设置登录密码" />
      <van-field v-model="form.sureUser_pass" placeholder="请再次输入密码" />
    </van-cell-group>
    <van-button
      style="width: 92%; margin: auto; margin-top: 30px"
      type="primary"
      color="#f15a24"
      block
      @click="onSubmit"
      >提交</van-button
    >
  </div>
</template>

<style lang="scss" scoped>
.van-field {
  border-bottom: 2xp solid #999;
}
</style>
